#include<bits/stdc++.h>

using namespace std;
string S = "ABCDEFGHIJKLMNOPRSTUVWXY0123456789";
string T = "2223334445556667778889990123456789";

string trim(string &s) {
    string t;
    for (int i = 0; i < s.size(); i++) {
        if (S.find(s[i]) != string::npos) {
            t.push_back(T[S.find(s[i])]);
        }
    }
    t.insert(t.begin() + 3, '-');
    return t;
}

int main() {
    int n;
    cin >> n;
    map<string, int> M;
    int Max = 0;
    for (int i = 0; i < n; i++) {
        string t;
        cin >> t;
        t = trim(t);
        M[t]++;
        Max = max(Max, M[t]);
    }
    if (Max == 1) {
        cout << "No duplicates" << endl;
    } else {
        for (map<string, int>::iterator it = M.begin(); it != M.end(); ++it) {
            if (it->second >= 2)
                cout << it->first << " " << it->second << endl;
        }
    }

    return 0;
}